package org.osoftware.mumi.dao.model;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;


/**
 * The Class Person.
 */
@MappedSuperclass
public abstract class Person extends BaseObject {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -7719510573940102332L;
	
	/** The last name. */
	@Column(name="last_name")
	private String lastName;
	
	/** The first name. */
	@Column(name="first_name")
	private String firstName;
	
	/** The e mail. */
	@Column(name="email")
	private String eMail;
	
	/** The birth date. */
	@Column(name="birth_date")
	private Date birthDate;
	
	/** The document type. */
	@Enumerated(EnumType.STRING)
	@Column(name="document_type")
	private DocumentType documentType;
	
	/** The document number. */
	@Column(name="document_number")
	private String documentNumber;
	
	/** The address. */
	@OneToOne(cascade=CascadeType.ALL)
	private Address address;
	
	/** The phones. */
	@OneToMany(cascade=CascadeType.ALL)
	private List<Phone> phones = new ArrayList<Phone>();
	
	
	
	/**
	 * Gets the phones.
	 *
	 * @return the phones
	 */
	public List<Phone> getPhones() {
		return phones;
	}

	/**
	 * Sets the phones.
	 *
	 * @param phones the new phones
	 */
	public void setPhones(List<Phone> phones) {
		this.phones = phones;
	}

	/**
	 * Gets the address.
	 *
	 * @return the address
	 */
	public Address getAddress() {
		return address;
	}

	/**
	 * Sets the address.
	 *
	 * @param address the new address
	 */
	public void setAddress(Address address) {
		this.address = address;
	}

	/**
	 * Gets the last name.
	 *
	 * @return the last name
	 */
	public String getLastName() {
		return lastName;
	}
	
	/**
	 * Sets the last name.
	 *
	 * @param lastName the new last name
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	/**
	 * Gets the first name.
	 *
	 * @return the first name
	 */
	public String getFirstName() {
		return firstName;
	}
	
	/**
	 * Sets the first name.
	 *
	 * @param firstName the new first name
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	/**
	 * Gets the e mail.
	 *
	 * @return the e mail
	 */
	public String geteMail() {
		return eMail;
	}
	
	/**
	 * Sets the e mail.
	 *
	 * @param eMail the new e mail
	 */
	public void seteMail(String eMail) {
		this.eMail = eMail;
	}
	
	/**
	 * Gets the birth date.
	 *
	 * @return the birth date
	 */
	public Date getBirthDate() {
		return birthDate;
	}
	
	/**
	 * Sets the birth date.
	 *
	 * @param birthDate the new birth date
	 */
	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}
	
	/**
	 * Gets the document type.
	 *
	 * @return the document type
	 */
	public DocumentType getDocumentType() {
		return documentType;
	}
	
	/**
	 * Sets the document type.
	 *
	 * @param documentType the new document type
	 */
	public void setDocumentType(DocumentType documentType) {
		this.documentType = documentType;
	}
	
	/**
	 * Gets the document number.
	 *
	 * @return the document number
	 */
	public String getDocumentNumber() {
		return documentNumber;
	}
	
	/**
	 * Sets the document number.
	 *
	 * @param documentNumber the new document number
	 */
	public void setDocumentNumber(String documentNumber) {
		this.documentNumber = documentNumber;
	}

	/* (non-Javadoc)
	 * @see org.osoftware.mumi.dao.model.BaseObject#toString()
	 */
	@Override
	public String toString() {
		return "Person [lastName=" + lastName + ", firstName=" + firstName
				+ ", eMail=" + eMail + ", birthDate=" + birthDate
				+ ", documentType=" + documentType + ", documentNumber="
				+ documentNumber + ", toString()=" + super.toString() + "]";
	}
	
	
}
